<?php

 class MenuUtility
 {
	
	public function generateMenu($parentModuleId = 0,$userType = 0,$byuserType = 0)
	{
		Zend_Loader::loadClass("AuthUtility");
		
		$auth = BaseAuth::getInstance();
		$userId = $auth->id;
		$userTypeId = $auth->user_type_id;
		
		
		Zend_Loader::loadClass("Modules");
		$modules = new Modules();
		if($byuserType == 0 ) {
			if($userId){
				$modulesArray = $modules->getAllowedModulesArray($userId,$userTypeId,$parentModuleId);
			}else{
				$modulesArray = $modules->getAllowedModulesArray(0,0,$parentModuleId);
			}
		} else {
			$modulesArray = $modules->getUserTypeModule($userType,$parentModuleId);
		}
		
		return $modulesArray;
	}
	
	
 }
?>
